<?php

	define('__ROOT__', dirname(dirname(__FILE__)));
	require_once(__ROOT__.'\models\Conn.php'); 
	require_once(__ROOT__.'\models\User.php'); 

class LoginController extends Controller{
	
	private $user_name;
	private $password;
	
	public function base(){
		
		header("Location:app/views/login.php"); 
	}
	
	public function logincheck(){
		$username = $_POST['username'];
		$password = $_POST['password'];
		$user = new User($username, $password);
		$user->checkLogin();
		if($user->checkLogin())
		{
			//session_start();
			$_SESSION["username"]=$username;
			header("Location:app/views/admin.php");
		}			
		else
			header("Location:app/views/login_error.php");
	}
	
	public function setParams($params)
	{
		//var_dump($params);die;
	}
}
